package util;

/**
 *
 * @author Grega
 */
public class OrderedPair<V>
{
  public final V v1, v2;

  public OrderedPair(V v1, V v2)
  {
    this.v1 = v1;
    this.v2 = v2;
  }

  @Override
  public boolean equals(Object obj)
  {
    if (obj instanceof OrderedPair) {
      OrderedPair pair = (OrderedPair)obj;
      if (pair.v1.equals(v1) && pair.v2.equals(v2)) {
        return true;
      }
    }
    return false;
  }

  @Override
  public int hashCode()
  {
    int hash = 5;
    hash = 71 * hash + (this.v1 != null ? this.v1.hashCode() : 0);
    hash = 71 * hash + (this.v2 != null ? this.v2.hashCode() : 0);
    return hash;
  }

  @Override
  public String toString()
  {
    return "(" + v1.toString() + ", " + v2.toString() + ")";
  }

  public V getV1()
  {
    return v1;
  }

  public V getV2()
  {
    return v2;
  }

}
